package com.zhoutao123.hephaestus.repository;

import com.zhoutao123.hephaestus.repository.dao.BlogMapper;
import com.zhoutao123.hephaestus.repository.entity.Blog;
import com.zhoutao123.hephaestus.repository.entity.BlogExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class BlogRepo extends MyBatisGeneratedRepo<BlogExample, BlogExample.Criteria, Blog, Blog> {

    @Autowired
    private BlogMapper mapper;

    @Override
    Mapper<BlogExample, Blog, Blog> getMapper() {
        return new Mapper<BlogExample, Blog, Blog>() {
            @Override
            public long countByExample(BlogExample blogExample) {
                return mapper.countByExample(blogExample);
            }

            @Override
            public int insert(Blog blog) {
                return mapper.insert(blog);
            }

            @Override
            public int insertSelective(Blog blog) {
                return mapper.insertSelective(blog);
            }

            @Override
            public int deleteByExample(BlogExample blogExample) {
                return mapper.deleteByExample(blogExample);
            }

            @Override
            public int updateByPrimaryKey(Blog blog) {
                return mapper.updateByPrimaryKey(blog);
            }

            @Override
            public int updateByPrimaryKeySelective(Blog blog) {
                return mapper.updateByPrimaryKeySelective(blog);
            }

            @Override
            public int updateByExample(Blog blog, BlogExample blogExample) {
                return mapper.updateByExample(blog, blogExample);
            }

            @Override
            public int updateByExampleSelective(Blog blog, BlogExample blogExample) {
                return mapper.updateByExampleSelective(blog, blogExample);
            }

            @Override
            public List<Blog> selectByExample(BlogExample blogExample) {
                return mapper.selectByExample(blogExample);
            }
        };
    }

    @Override
    BlogExample createExample() {
        return new BlogExample();
    }

    @Override
    BlogExample.Criteria createCriteria(BlogExample blogExample) {
        return blogExample.createCriteria();
    }
}
